package org.pf.base.pfPools
{
	import org.pf.interfaces.IPFBlock;
	import org.pf.interfaces.IPFPool;
	
	/**
	 * ...
	 * @author zeksa'
	 */
	public class PFPool implements IPFPool
	{
		private var _list:Array;
		
		public function PFPool()
		{
		
		}
		
		public function init():void
		{
			_list = new Array();
		}
		
		public function setBlock(block:IPFBlock):void
		{
			_list.push(block);
		}
		
		public function getBlock(name:String):IPFBlock
		{
			var i:int = 0;
			var prt:IPFBlock;
			while (i < _list.length)
			{
				if (_list[i]._name == name)
				{
					prt = _list[i];
					break;
				}
				else
				{
					i++;
				}
			}
			return prt;
		}
		
		public function removeBlock(name:String):void
		{
			var i:int = 0;
			while (i < _list.length)
			{
				if (_list[i]._name == name)
				{
					_list = _list.splice(_list[i]);
					break;
				}
				else
				{
					i++;
				}
			}
		}
	
	}

}